package cn.kgc.springbootdemo.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;


@ApiModel("注册用户表单")
@Data
public class RegisterUserForm implements Serializable {

    /**
     *  用户账号
     */
    @Size(min = 5,max = 32,message = "长度必须大于等于6小于32位")
    @NotBlank(message = "用户账号不能为空")
    @ApiModelProperty(value = "用户账号",name = "userCode",required = true)
    private String userCode;

    /**
     * 用户密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(min = 6,max = 32,message = "密码长度必须大于等于6小于32位")
    @ApiModelProperty(value = "密码",name = "password",required = true)
    private String password;

    /**
     * 确认密码
     */
    @NotBlank(message = "确认密码不能为空")
    @ApiModelProperty(value = "确认密码",name = "verifyPassword",required = true)
    private String verifyPassword;

    /**
     * 性别
     */
    @NotNull(message = "性别不能为空")
    @ApiModelProperty(value = "性别1是男 2是女",name = "sex",required = true)
    private Integer sex;

    /**
     * 电话号码
     */
    @Pattern(regexp = "^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$",message = "请输入正确的手机号")
    @ApiModelProperty(value = "电话号码",name = "phone")
    private String phone;

    /**
     * 出生日期
     */
    @PastOrPresent
    @ApiModelProperty(value = "出生日期",name = "birth")
    private LocalDate birth;



    /**
     * 用户名称
     */
    @NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名称",name ="userName")
    private String userName;


    /**
     * 身份证
     */
    @Pattern(regexp = "^[1-8][1-7]\\d{4}(?:19|20)\\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\\d|3[01])\\d{3}[\\dX]$",message = "身份证格式不正确")
    @NotBlank(message = "身份证不能为空")
    @ApiModelProperty(value = "身份证",name = "idCard")
    private String idCard;

    @ApiModelProperty(value = "验证码",required = true)
    @NotBlank(message = "验证码不能为空")
    private String verifyCode;

    @ApiModelProperty("角色Id")
    @NotBlank(message = "角色不能为空")
    private String roleId;
}
